﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ListenServer
{
    public partial class Img : Form
    {
        byte[] imgBytesIn;
        public Img(byte [] imgBytesIn)
        {
            InitializeComponent();
            this.imgBytesIn = imgBytesIn;
            MemoryStream ms = new MemoryStream(imgBytesIn);
            pictureBox1.Image = Image.FromStream(ms);
        }

        private void Img_Load(object sender, EventArgs e)
        {

        }

        private void 保存ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveImageDialog = new SaveFileDialog();
            saveImageDialog.Filter = "Image Files (*.jpg;*.png)|*.jpg;*.png";
            //openImageDialog.Multiselect = false;

            if (saveImageDialog.ShowDialog() == DialogResult.OK)
            {
                Utils.ShowImgByByte(imgBytesIn, saveImageDialog.FileName);
               
            }
            else
            {
            }
        }
    }
}
